﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Public;

namespace DAL
{
    public class TrinhTrangVeDAL
    {
        clsKetNoi kn = new clsKetNoi();
        public int ThemTrinhTrangVe(TrinhTrangVePublic p)
        { 
            int Nparameter = 3;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "SoLuongGheTrong"; value[0] = p.SoLuongGheTrong;
            name[1] = "SoLuongGheDat"; value[1] = p.SoLuongGheDat;
            name[2] = "MaChuyenBay"; value[2] = p.MaChuyenBay;
            return kn.Update("TrinhTrangVe_Insert",name,value,Nparameter);
 
        }
        public DataTable TrinhTrangVe_GheTrong(TrinhTrangVePublic p)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "MaChuyenBay"; value[0] = p.MaChuyenBay;
            return kn.LayDuLieu("TrinhTrangVe_GheTrong",name,value,Nparameter);
        }
        public DataTable TrinhTrangVe_GheDat(TrinhTrangVePublic p)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "MaChuyenBay"; value[0] = p.MaChuyenBay;
            return kn.LayDuLieu("TrinhTrangVe_GheDat", name, value, Nparameter);
        }
        public int TrinhTrangVe_update(TrinhTrangVePublic p)
        {
            int Npameter = 3;
            string[] name = new string[Npameter];
            object[] value = new object[Npameter];
            name[0] = "SoLuongGheTrong"; value[0] = p.SoLuongGheTrong;
            name[1] = "SoLuongGheDat"; value[1] = p.SoLuongGheDat;
            name[2] = "MaChuyenBay"; value[2] = p.MaChuyenBay;
            return kn.Update("TrinhTrangVe_Edit", name, value, Npameter);
        }
        public int TrinhTrangVe_Xoa(TrinhTrangVePublic p)
        {
            int Nparameter = 1;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "MaChuyenBay"; value[0] = p.MaChuyenBay;
            return kn.Update("TrinhTrangVe_Delete", name, value, Nparameter);
        }
    }
}
